package cn.flaty.views.web;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

/**
 * json 基础数据包装器
 * 
 * @author flatychen
 *
 */
public class JsonBaseWrapper {
	
	/**
	 * 调用是否成功
	 */
	private boolean success;
	
	/**
	 * 调用返回消息，如为成功可为空
	 */
	private String message;
	
	/**
	 * 版本
	 */
	private String version = "1.0";
	
	
	/**
	 * 调用返回数据
	 */
	private Map<String,Object> data;


	public boolean isSuccess() {
		return success;
	}


	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMessage() {
		if(this.success && StringUtils.isBlank(message)){
			this.message = "调用成功";
		}
		return message;
	}


	public void setMessage(String message) {
		this.message = message;
	}


	public String getVersion() {
		return version;
	}


	public void setVersion(String version) {
		this.version = version;
	}


	public Map<String, Object> getData() {
		return data;
	}


	public void setData(Map<String, Object> data) {
		this.data = data;
	}


	@Override
	public String toString() {
		return "JsonBaseWrapper [success=" + success + ", message=" + message
				+ ", version=" + version + ", data=" + data + "]";
	}
	
	
	
	
}
